package common

import (
	"context"
	proto "xagent/proto/v1"

	"github.com/asynkron/protoactor-go/actor"
)

// Agent defines the common interface for all agents
type Agent interface {
	Initialize()
	ProcessTask(task *proto.Task)
	SendMessage(to *actor.PID, message *proto.AgentMessage)
	GetContext() actor.Context
}

// AICapable defines the interface for AI-capable agents
type AICapable interface {
	Agent
	ProcessWithAI(ctx context.Context, task *proto.Task) (string, error)
	GenerateCode(ctx context.Context, spec string, language string) (string, error)
	AnalyzeCode(ctx context.Context, code string) (string, error)
}

// TeamMember defines the interface for team member agents
type TeamMember interface {
	AICapable
	GetRole() string
	GetCapabilities() []string
	HandleFeedback(feedback *proto.FeedbackMessage)
}

// Coordinator defines the interface for team coordinator
type Coordinator interface {
	TeamMember
	InitiateCollaboration(req *proto.CollaborationRequest) (*proto.CollaborationSession, error)
	ShareKnowledge(knowledge *proto.KnowledgeShare) error
	InitiateTeamSync(sync *proto.TeamSync) error
}

// MetricsProvider defines the interface for agents that provide metrics
type MetricsProvider interface {
	GetMetrics() map[string]interface{}
	UpdateMetrics()
}

// MemoryCapable defines the interface for agents with memory capabilities
type MemoryCapable interface {
	SaveMemory(memory interface{}) error
	LoadMemory(id string) (interface{}, error)
	SearchMemories(query string) ([]interface{}, error)
}
